var express = require('express')
var path = require('path')
var cookieParser = require('cookie-parser')
var logger = require('morgan')

var bodyParser = require('body-parser')

// 导入cors包
const cors = require('cors')

const ggEventRouter = require('./routes/gg_event')
const ggUserRouter = require('./routes/gg_user')
const GGnotice = require('./routes/gg_notice')

var app = express()

// 注册全局中间件
app.use(cors())
app.use(logger('dev'))
app.use(express.json())
app.use(express.urlencoded({ extended: false }))
app.use(cookieParser())

app.use('/gg_event', ggEventRouter)
app.use('/gg_user', ggUserRouter)
app.use('/gg_notice', GGnotice)

module.exports = app
